﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class login : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
    //double d = 1998.32, a = -999.31;
    //d = d + Convert.ToDouble(a.ToString());
    //Response.Write(d.ToString());
  }
  protected void btnDL_Click(object sender, EventArgs e)
  {
    bool flag = false;
    string sID = "";
    string sSql = "select * from sys_user where dlm=@0 and mm=@1";
    SqlParameter[] cmdParams = new SqlParameter[2] { new SqlParameter("@0", SqlDbType.VarChar, 10), new SqlParameter("@1", SqlDbType.VarChar, 20) };
    cmdParams[0].Value = txtUserName.Text;
    cmdParams[1].Value = DESEncrypt.Encrypt(txtPWD.Text);
    SqlDataReader dr = DbHelperSQL.ExecuteReader(sSql, cmdParams);
    if (dr.Read())
    {
      flag = true;
      sID = dr["dlm"].ToString();
    }
    dr.Close();
    if (flag)
    {
      SysManage.Signin(sID);
      Response.Redirect("First.aspx");
      Response.Flush();
    }
    else
    {
      lbMessage.Text = "用户名或密码错误";
    }
  }
}
